package com.suge.user.dao.impl;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.suge.user.dao.UserDAO;
import com.suge.user.dao.dataobject.UserDO;

public class UserDAOImpl extends SqlMapClientDaoSupport  implements UserDAO {

	public UserDO getAppUserByUserId(long userId) {
		return (UserDO) this.getSqlMapClientTemplate().queryForObject("AppUser.querySingleAppUserById",userId);
	}

	public boolean updateUserInfo(UserDO appUserDO) {
		return this.getSqlMapClientTemplate().update("AppUser.updateUser", appUserDO)>0;
	}

	public boolean insertUser(UserDO appUserDO) {
		this.getSqlMapClientTemplate().insert("AppUser.insertUser", appUserDO);
		return true;
	}

	public UserDO getAppUserByUserNick(String userNick) {
		return (UserDO) this.getSqlMapClientTemplate().queryForObject("AppUser.querySingleAppUserByNick",userNick);

	}

}
